﻿<navigation:Page 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
    xmlns:ds="clr-namespace:CARE.Web.Services"
	xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

    x:Class="CARE.DiseaseModel" 
	Title="DiseaseModel Page"
	d:DesignWidth="640" d:DesignHeight="480" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria">
    
    <Grid x:Name="LayoutRoot" >

        <Border Background="White" CornerRadius="5">
			<Grid ShowGridLines="False">
				<Grid.RowDefinitions>
					<RowDefinition Height="35" />
					<RowDefinition />
					<RowDefinition Height="5" />
				</Grid.RowDefinitions>

				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="5" />
					<ColumnDefinition />
					<ColumnDefinition Width="5" />
				</Grid.ColumnDefinitions>

				<TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="20"
					Grid.Row="0" Grid.ColumnSpan="3" ><Run Text="Diseases Models Management Module"/></TextBlock>
				<Line StrokeThickness="1" Stroke="Black" X1="0" X2="770" Y1="30" Y2="30"
					Grid.ColumnSpan="3" Grid.RowSpan="3" />

				<Grid ShowGridLines="False" Grid.Column="1" Grid.Row="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="200" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>

					<Grid ShowGridLines="False" Grid.Column="0">
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
							<RowDefinition Height="150" />
						</Grid.RowDefinitions>

						<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"
							Margin="5,0,5,0" Grid.Row="0">
							<TextBlock><Run Text="Diseases list:"/></TextBlock>
							<ListBox x:Name="Diseases" Height="269" BorderThickness="5" BorderBrush="SteelBlue"
								SelectionChanged="Diseases_SelectionChanged" ItemsSource="{Binding ElementName=diseaseDomainDataSource, Path=Data}" DataContext="{Binding}" />
						</StackPanel>

						<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical"
							Margin="5,5,5,5" Grid.Row="1">
                            <Button x:Name="LinkCreate" Height="40" Click="LinkCreate_Click"
                                             Content="Create a new model"  />
							<Button x:Name="LinkEditModel" Height="40" Click="LinkEditModel_Click"
                                             Content="Edit model"  Margin="0,10,0,0" />
							<Button x:Name="RemoveChosenModel" Content="Remove the chosen model" Height="40"
								Margin="0,10,0,0" Click="RemoveChosenModel_Click" />
						</StackPanel>
					</Grid>

					<Grid ShowGridLines="False" Grid.Column="1">
						<Grid.RowDefinitions>
							<RowDefinition Height="200" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>

						<Border BorderBrush="Gray" BorderThickness="1" Grid.Row="0">
							<Grid ShowGridLines="False">
								<Grid.RowDefinitions>
									<RowDefinition Height="25" />
									<RowDefinition Height="175" />
								</Grid.RowDefinitions>

								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="200" />
									<ColumnDefinition Width="*" />
								</Grid.ColumnDefinitions>

								<TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="14"
									Grid.Column="0" Grid.Row="0"><Run Text="Model description:"/></TextBlock>
								<Border BorderBrush="Black" BorderThickness="1" CornerRadius="5"
									Margin="5,5,5,5" Grid.Column="0" Grid.Row="1">
									<TextBlock x:Name="Description" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding SelectedItem.description, ElementName=Diseases, Mode=OneWay}"
										VerticalAlignment="Center" Margin="5,5,5,5"/>
								</Border>

								<TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="14"
									Grid.Column="1" Grid.Row="0"><Run Text="Edit the model description:"/></TextBlock>
                                <TextBox Grid.Column="1" Grid.Row="1" Name="descriptionTextBox" Text="{Binding Path=SelectedItem.description, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true, ElementName=Diseases}" />
                            </Grid>
						</Border>

						<Border BorderBrush="Gray" BorderThickness="1" Grid.Row="1">
							<Grid ShowGridLines="False">
								<Grid.RowDefinitions>
									<RowDefinition Height="25" />
									<RowDefinition Height="*" />
								</Grid.RowDefinitions>

								<TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="14"
									Grid.Row="0"><Run Text="Model visualization:"/></TextBlock>
								<Line StrokeThickness="2" Stroke="Gray" X1="0" X2="560" Y1="25" Y2="25" />
								<Canvas x:Name="rootCanvas" Grid.Row="1"/>
							</Grid>
						</Border>
					</Grid>
				</Grid>
                <riaControls:DomainDataSource AutoLoad="True" Height="0" LoadedData="diseaseDomainDataSource_LoadedData" Name="diseaseDomainDataSource" QueryName="GetDiseasesQuery" Width="0">
                    <riaControls:DomainDataSource.DomainContext>
                        <ds:DataProvider />
                    </riaControls:DomainDataSource.DomainContext>
                </riaControls:DomainDataSource>
            </Grid>
		</Border>

	</Grid>
</navigation:Page>